<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>登录</title>
    <link rel="stylesheet" href="/scriptZIP/index.css">
    <style>
        .el-button {
            width: 178px;
            line-height: 50px;
            font-size: 18px;
        }
    </style>
</head>

<body>
    <div id="login_WQ_agent">
        <el-container>
            <el-header>

            </el-header>
            <el-main v-loading="loading" style="text-align: center;">
                <el-button type="primary" size="medium" @click="loginAgent(agentId)">进入代理商</el-button>
            </el-main>
        </el-container>
    </div>
    <script src="https://cdn.w7.cc/ued/console/jssdkv2.js"></script>

    <script src="/scriptZIP/qs.min.js"></script>
    <script src="/scriptZIP/vue.min.js"></script>
    <script src="/scriptZIP/axios.min.js"></script>
    <script src="/scriptZIP/flatpickr.min.js"></script>
    <script src="/scriptZIP/zh.min.js"></script>
    <script src="https://unpkg.com/element-ui/lib/index.js"></script>

    <script src="/lib/vue-flatpickr.min.js"></script>
    <!-- <script src="https://cdn.bootcdn.net/ajax/libs/js-cookie/3.0.5/js.cookie.js"></script> -->
    <!-- <script src="/js/common.js"></script> -->
    <script>
        new Vue({
            el: '#login_WQ_agent',
            data: {
                code: '',
                loading: false,
                agentId: ''
            },
            mounted: function () {
                var that=this
                w7.ready(function () {
                    w7.login(function (evt) {
                        this.code = evt.data.code;
                        // console.log(this.code, 'code1');
                        var obj = { code: this.code }
                        axios.post('https://wei.hxt5.com/api/dls', new URLSearchParams(obj)).then(function (e) {
                        // console.log(e.data, 'e.data');
                            that.agentId = e.data.agentId
                            axios.post('https://wei.hxt5.com/api/login', new URLSearchParams(e.data)).then(function (res) {
                                // setTimeout(() => {
                                //     this.loading = true
                                // }, 2000)
                            }.bind(this));
                        }.bind(this));

                    });
                });

            },
            methods: {
                loginAgent(agentId) {
                    this.loading=true
					setTimeout(() => {
						this.loading = false
						open("https://wei.hxt5.com/agent/agent_menu.html?id=" + agentId, '_blank');
					}, 1300)
                    
                }
            }
        })
    </script>
</body>

</html>